#include "widget.h"
#include "ui_widget.h"
#include <qDebug>
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    qDebug()<<"main" <<QThread::currentThreadId();

    thread = new QThread();
    serial *s = new serial();
    s->moveToThread(thread);
    thread->start();

    connect(this,SIGNAL(sig_open()),s,SLOT(open()));
    connect(this,SIGNAL(sig_write(QString)),s,SLOT(write(QString)));
//    connect(s->serialPort,SIGNAL(readyRead()),s,SLOT(read()));

    emit sig_open();
    emit sig_write("ttt");
}

Widget::~Widget()
{
    delete ui;
}
